//
//  NThemeCollectionViewCell.m
//  News
//
//  Created by zhangtao on 2018/10/10.
//  Copyright © 2018年 zt.td. All rights reserved.
//

#import "NThemeCollectionViewCell.h"

@implementation NThemeCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    _maskView.layer.cornerRadius = 3;
    _maskView.layer.masksToBounds = YES;
    _maskView.layer.borderWidth = 1;
    _maskView.layer.borderColor = RGB(245, 245, 245, 1).CGColor;
}
- (IBAction)addClick:(UIButton *)sender {

    if (self.delegate && [self.delegate respondsToSelector:@selector(themeCancelOrfocusModel:cancel: cell:)]) {
        [self.delegate themeCancelOrfocusModel:_model cancel:!sender.selected cell:self];
    }
}

-(void)setModel:(NTopicalModel *)model{
    _model = model;
    NSString *img = [NSString stringWithFormat:@"%@%@",ImageUrl,model.CoverPic];
    [_imgV sd_setImageWithURL:[NSURL URLWithString:img] placeholderImage:default_max_img];
    _nameLab.text = model.TopicalName;
    _articalNumLab.text = [NSString stringWithFormat:@"%@",model.ArticleNum];
    _followNumLab.text = [NSString stringWithFormat:@"%@",model.FollowNum];
    
    NOnlineFocusModel *focuModel = [NOnlineFocusModel sharedInstance];
    for (NSNumber *fouId in focuModel.fouceArray) {
        if (model.ID == fouId) {
            _focusBtn.selected = YES;
            break;
        }else{
            _focusBtn.selected = NO;
        }
    }
}

@end
